]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
use TpAccountChannelRequest to re-ensure the channel
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 8 Feb 2011 10:53:40 +0000 (11:53 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 16 Feb 2011 09:09:43 +0000 (10:09 +0100)
js/ui/telepathyClient.js

index 424da0a400deea5119a050075f1e9d6e79f4da43..ca010c95e3555b356d74fadffb57b17afe84c0b8 100644 (file)
@@ -15,7 +15,6 @@ const MessageTray = imports.ui.messageTray;
 const Telepathy = imports.misc.telepathy;
 
 let contactManager;
-let channelDispatcher;
 
 // See Notification.appendMessage
 const SCROLLBACK_IMMEDIATE_TIME = 60; // 1 minute
@@ -52,10 +51,6 @@ Client.prototype = {
         contactManager = new ContactManager();
         contactManager.connect('presence-changed', Lang.bind(this, this._presenceChanged));
 
-        channelDispatcher = new Telepathy.ChannelDispatcher(DBus.session,
-                                                            Tp.CHANNEL_DISPATCHER_BUS_NAME,
-                                                            Tp.CHANNEL_DISPATCHER_OBJECT_PATH);
-
         // Set up a SimpleObserver, which will call _observeChannels whenever a
         // channel matching its filters is detected.
         // The second argument, recover, means _observeChannels will be run
@@ -434,22 +429,11 @@ Source.prototype = {
     _notificationClicked: function(notification) {
         let props = {};
         props[Tp.PROP_CHANNEL_CHANNEL_TYPE] = Tp.IFACE_CHANNEL_TYPE_TEXT;
-        props[Tp.PROP_CHANNEL_TARGET_HANDLE] = this._targetHandle;
-        props[Tp.PROP_CHANNEL_TARGET_HANDLE_TYPE] = this._targetHandleType;
-        channelDispatcher.EnsureChannelRemote(this._account.get_object_path(), props,
-                                              global.get_current_time(),
-                                              '',
-                                              Lang.bind(this, this._gotChannelRequest));
-    },
+        [props[Tp.PROP_CHANNEL_TARGET_HANDLE], props[Tp.PROP_CHANNEL_TARGET_HANDLE_TYPE]] = this._channel.get_handle();
 
-    _gotChannelRequest: function (chanReqPath, ex) {
-        if (ex) {
-            log ('EnsureChannelRemote failed? ' + ex);
-            return;
-        }
+        let req = Tp.AccountChannelRequest.new(this._account, props, global.get_current_time());
 
-        let chanReq = new Telepathy.ChannelRequest(DBus.session, Tp.CHANNEL_DISPATCHER_BUS_NAME, chanReqPath);
-        chanReq.ProceedRemote();
+        req.ensure_channel_async('', null, null);
     },
 
     _gotPendingMessages: function(msgs, err) {